package com.crm.controller.hy;

import com.crm.utils.R;
import com.crm.vo.AddressEmployeeVo;
import com.crm.vo.AdvancedSearchVo;
import com.crm.vo.RetrieveVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * 内部通讯录
 */
@Api(value = "内部通讯录",tags = "内部通讯录api")
@Controller
@RequestMapping("/address")
public class AddressController {

    R r=new R();

    @PostMapping("/findAll")
    @ApiOperation(value = "通讯录列表(包括其他部门的查询)", httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页码数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "type", value = "查询的部门序号(0-9 其中0:全部,1:总经办…9:已离职）", paramType = "query", dataType = "int", required = true),
    })
    @ResponseBody
    public R findAll(Integer currentPage,Integer pageSize,Integer type){
        AddressEmployeeVo address=new AddressEmployeeVo(1,"张三","19812343212","28345423@qq.com","业务一部",new Date("2001-02-29"),new Date());
        return r.okR(address);
    }

    @PostMapping("/search")
    @ApiOperation(value = "搜索(包括所有部门)", httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页码数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "type", value = "查询的部门序号(0-9 其中0:全部,1:总经办…9:已离职）", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "value", value = "搜索的条件字段", paramType = "query", dataType = "string", required = true),

    })
    @ResponseBody
    public R search(Integer currentPage,Integer pageSize,Integer type){
        AddressEmployeeVo address=new AddressEmployeeVo(1,"张三","19812343212","28345423@qq.com","业务一部",new Date("2001-02-29"),new Date());
        return r.okR(address);
    }

    @PostMapping("/advancedSearch")
    @ApiOperation(value = "搜索(包括所有部门)", httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页码数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "int", required = true),
            @ApiImplicitParam(name = "type", value = "查询的部门序号(0-9 其中0:全部,1:总经办…9:已离职）", dataType = "int", required = true),
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "string", required = true),
            @ApiImplicitParam(name = "sex", value = "性别",dataType = "string", required = true),
            @ApiImplicitParam(name = "phone", value = "手机号码", dataType = "string", required = true),
            @ApiImplicitParam(name = "birthdayF", value = "生日前区间",dataType = "date", required = true),
            @ApiImplicitParam(name = "birthdayL", value = "生日后区间",dataType = "date", required = true),
            @ApiImplicitParam(name = "departmentId", value = "所在部门",dataType = "int", required = true),
            @ApiImplicitParam(name = "departureStatus", value = "是否离职(0:在职，1:已离职)",dataType = "int", required = true),

    })
    @ResponseBody
    public R advancedSearch(@RequestBody AdvancedSearchVo advancedSearchVo){
        AddressEmployeeVo address=new AddressEmployeeVo(1,"张三","19812343212","28345423@qq.com","业务一部",new Date("2001-02-29"),new Date());
        return r.okR(address);
    }

}
